var memorier = function(f) {
    var hash=[];
    return function() {
        var signature = Array.prototype.join.apply(arguments);
        if(hash[signature]) return hash[signature];
        var ret = f.apply(this, arguments);
        hash[signature] = ret;
        return ret;
    }
}

function inner_factor(n) {
    if(n==0) return 0;
    if(n==1) return 1;
    var ret = 1;
    for(var i=1; i<=n; i++) {
        ret *=i;
    }
    return ret;
}

factor = memorier(inner_factor);


function comb(n,r) {
    if(r==0||n==r) return 1;
    return factor(n)/factor(r)/factor(n-r);
};

print(comb(23,10));
print(comb(23,11));
print(comb(23,12));
print(comb(23,13));

var count=0;
for(var n=2; n<=100; n++) {
    for(var r=0; r<=n; r++) {
        var tmp = comb(n,r);
        if(tmp>1000000) {
            print("c("+ n + "," + r + ")=" + tmp);
            //count = count + (n-2*r+1)
            count++
            //break;
        }
    }
}

print(count);
